import {Component, OnInit} from '@angular/core';
import {TypeService} from '../../shared/service/type.service';
import {Router} from '@angular/router';

@Component({
  selector: 'app-type',
  templateUrl: './type.component.html',
  styleUrls: ['./type.component.scss']
})
export class TypeComponent implements OnInit {
  types;

  constructor(private typeService: TypeService, private route: Router) {
  }

  ngOnInit() {
    this.typeService.getTypeList().subscribe((res) => {
      this.types = res;
    });
  }

  goList(type) {
    // this.route.navigateByUrl('/type/typearticle');
    this.route.navigate(['/type/typearticle'],
      {queryParams: {name: type.name, nums: type.nums}});
  }
}
